<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Flashgame
 * @version    $Id: index.tpl 6755 2010 YouNet $
 * @author     To Anh
 */
?>
<h2><?php echo $this->translate("Games Plugin") ?></h2>

<?php if( count($this->navigation) ): ?>
  <div class='tabs'>
    <?php
      // Render the menu
      //->setUlClass()
      echo $this->navigation()->menu()->setContainer($this->navigation)->render()
    ?>
  </div>
<?php endif; ?>

  <div class='clear'>
    <div class='settings'>
    <form class="global_form">
      <div>
        <h3><?php echo $this->translate("Game Packages") ?> </h3>
          <?php if(count($this->packages)>0):?>

         <table class='admin_table'>
          <thead>

            <tr>
              <th><?php echo $this->translate("Package Name") ?></th>
              <th><?php echo $this->translate("Sold") ?></th>
              <th><?php echo $this->translate("Users"); ?></th>
              <th><?php echo $this->translate("Enable") ?></th>
              <!--th><?php echo $this->translate("Associated Level") ?></th-->
              <!--th><?php echo $this->translate("Downgrade Level") ?></th-->
              
              <!--th><?php echo $this->translate("Plan Period") ?></th-->
              <!--th><?php echo $this->translate("Recurring?") ?></th-->
              <th><?php echo $this->translate("Price") ?></th>
              <!--<th><?php //echo $this->translate("Initial price") ?></th>-->
              <th><?php echo $this->translate("Options") ?></th>
            </tr>

          </thead>
          <tbody>
            <?php foreach ($this->packages as $package): ?>
              <tr>
                <td><?php echo $package->package_name; ?></td>
                <td>
                    <?php echo $package->package_sold ?>
                </td>
                <td>
                    <?php if ($package->totalusers > 0): ?>
                    <a href="<?php echo $this->url(array('package_id' => $package->package_id), 'flashgame_admin_package_packageusers') ?>">
                    <?php echo $package->totalusers?>
                    </a>    
                    <?php else: ?>
                        <?php echo $package->totalusers ?>
                    <?php endif; ?>
                
                </td>
                <td>
                    <?php 
                        if ($package->package_enabled):
                    ?>
                             <a href="<?php echo $this->url(array('package_id' => $package->package_id,'enable' => '0'), 'flashgame_admin_manage_package_enable') ?>"><?php echo $this->translate("yes") ?></a> 
                    <?php
                        else:
                    ?>
                        <a href="<?php echo $this->url(array('package_id' => $package->package_id, 'enable' => '1'), 'flashgame_admin_manage_package_enable') ?>"><?php echo $this->translate("no") ?></a> 
                    <?php endif; ?>
                </td>
                
                <!--td>
                      <?php //foreach ($this->user_levels as $user_level): ?>
                        <?php //if ($package->package_level_id==$user_level->level_id) echo $user_level->getTitle(); ?> 
                      <?php //endforeach; ?>
                </td-->
                <!--td><?php echo $package->package_downgrade_level_id ?></td-->
                <!--td><?php echo $package->package_period ?> <?php echo $package->package_periodtype ?></td-->
                <!--td><?php echo $package->package_recurring ?> <?php echo $package->package_recurring_cycles  ?></td-->
                <td><?php echo $package->package_price  ?></td>
                <!--<td><?php //echo $package->package_onetime_price ?></td>-->
                
                <td>
                    <a href="<?php echo $this->url(array('package_id' => $package->package_id), 'flashgame_admin_manage_package_view') ?>"><?php echo $this->translate("view") ?></a> |
                    <a href="<?php echo $this->url(array('package_id' => $package->package_id), 'flashgame_admin_manage_package_edit') ?>"><?php echo $this->translate("edit") ?></a> |
                  <?php echo $this->htmlLink(array('route' => 'admin_default', 'module' => 'flashgame', 'controller' => 'package', 'action' => 'delete', 'package_id' =>$package->package_id), $this->translate('delete'), array(
                    'class' => 'smoothbox',
                  )) ?>

                </td>
              </tr>
            <?php endforeach; ?>
          </tbody>
        </table>
      <?php else:?>
      <br/>
      <div class="tip">
      <span><?php echo $this->translate("There are currently no packages.") ?></span>
      </div>
      <?php endif;?>
        <br/>
        <a href="admin/flashgame/package/create"><?php echo $this->translate("Add New Package") ?></a>
    </div>
    </form>
    </div>
  </div>